package com.sixuerain.heartkey.prayer.db;

import android.content.Context;
import android.database.Cursor;

import com.sixuerain.heartkey.prayer.db.BaseDAO;
import com.sixuerain.heartkey.prayer.db.model.LectionHomeworkModel;
import com.sixuerain.heartkey.prayer.db.table.HomeworkTable;

public class HomeWorkDAO extends BaseDAO<LectionHomeworkModel> {

	public HomeWorkDAO(Context context) {
		super(context);
	}

	@Override
	public LectionHomeworkModel mapRow(Cursor cursor, int rowNum) {
		 
		LectionHomeworkModel lecHomework = new LectionHomeworkModel();
		lecHomework.setHomeworkName(cursor.getString(
				cursor.getColumnIndex(HomeworkTable.HWNAME)));
		lecHomework.setHomeworkId(cursor.getInt(
				cursor.getColumnIndex(HomeworkTable.ID)));
		lecHomework.setHomeworkOwner(cursor.getInt(
				cursor.getColumnIndex(HomeworkTable.HWOWNER)));
		lecHomework.setHomeworkGainer(cursor.getInt(
				cursor.getColumnIndex(HomeworkTable.HWGAINER)));
		lecHomework.setLectionID(cursor.getInt(
				cursor.getColumnIndex(HomeworkTable.LECTIONID)));
		lecHomework.setHomeworkGainerName(cursor.getString(
				cursor.getColumnIndex(HomeworkTable.HWGAINER_NAME)));
		lecHomework.setHomeworkOwnerName(cursor.getString(
				cursor.getColumnIndex(HomeworkTable.HWOWNER_NAME)));
		lecHomework.setHomeworkNotes(cursor.getString(
				cursor.getColumnIndex(HomeworkTable.HWNOTES)));
		return lecHomework;
	}

}
